package com.chance.cc.crawler.development.command.trigger.domain.sohu;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.development.command.job.domain.sohu.SoHuCommonScript;
import com.chance.cc.crawler.development.command.job.domain.sohu.realtime.SoHuNewsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.sohu.trace.SoHuNewsCommentTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.sohu.trace.SoHuNewsTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.trigger.CommonCrawlerTestSchedulerTrigger;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;

/**
 * @author lt
 * @version 1.0
 * @date 2021-03-25 17:33:50
 * @email okprog@sina.com
 */
public class SoHuNewsCrawlerTrigger extends CommonCrawlerTestSchedulerTrigger {
    public static void main(String[] args) {

        publishSoHuNewsRealtimeCrawlerScheduleTriggerInfo();

        publishSoHuNewsTraceCrawlerScheduleTriggerInfo();

        publishSoHuNewsCommentTraceCrawlerScheduleTriggerInfo();

    }

    /**
     * 发布搜狐新闻板块2小时采集实时任务trigger info

     */
    public static void publishSoHuNewsRealtimeCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuNewsRealtimeCrawlerSchedulerJob.crawlerScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0/10 * * * ?",
                "搜狐新闻板块实时采集任务执行，每十分钟执行一次"
        );
    }

    /**
     * 发布搜狐新闻板块采集回溯任务trigger info

     */
    public static void publishSoHuNewsTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuNewsTraceCrawlerSchedulerJob.crawlerScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0 * * ?",
                "搜狐新闻板块24小时回溯采集任务执行，每天执行一次"
        );
    }

    /**
     * 发布搜狐新闻板块采集回溯任务trigger info

     */
    public static void publishSoHuNewsCommentTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = SoHuNewsCommentTraceCrawlerSchedulerJob.crawlerScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                SoHuCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 * * * ?",
                "搜狐新闻板块每小时回溯采集任务执行，每小时执行一次"
        );
    }
}
